<script >
import SmallShow from './Small/SmallShow.vue';
import SmallHeader from './Small/SmallHeader.vue';
import SmallFooter from './Small/SmallFooter.vue';
export default {
  components: {
    SmallHeader,
    SmallFooter,
    SmallShow
  },
  props: {
    data: {
      type: Object,
    }
  }
}
</script>
<template>
  <div class="small-card">
    <el-card>
      <div class="header">
        <SmallHeader>
          <template v-slot:header-title>{{ data.HeaderName }}</template>
          <template v-slot:header-num>{{ data.HeaderNum }}</template>
        </SmallHeader>
      </div>
      <div class="content">
        <div v-if="data.content == []">
          <v-chart :option="data.option" style="height: 50px;width: 100%;"></v-chart>
        </div>
        <div v-else>
          <div v-for="(item, index) in data.content" :key="index" style="margin-bottom: 10px;">
            <SmallShow>
              <template v-slot:Sales>{{ item.title }}</template>
              <template v-slot:SalesGrow>{{ item.value }}</template>
            </SmallShow>
          </div>
        </div>
      </div>
      <el-divider></el-divider>
      <div class="footer">
        <div v-if='!data.FooterTest '>
          <SmallFooter>
            <template v-slot:footer-title>{{ data.FooterTitle }}</template>
            <template v-slot:footer-num>￥{{ data.FooterNum }}</template>
          </SmallFooter>
        </div>
        <div v-else style="display: flex">
          <div v-for="(item, index) in data.FooterTest" :key="index">
            <SmallShow>
              <template v-slot:Sales>{{ item.title }}</template>
              <template v-slot:SalesGrow>{{ item.value }}</template>
            </SmallShow>
          </div>
        </div>

      </div>

    </el-card>
  </div>
</template>
<style lang="scss" scoped >
.small-card {
width: 100%;

  .header {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #777;
    letter-spacing: 1px;
  }

  .footer {
    margin-top: 5px;
    display: flex;
    font-size: 14px !important;
    color: #464545;
  }

  .content {
    height: 50px;
    margin-top: 10px;
  }

 
}
.el-divider--horizontal {
    margin-top: 18px;
    margin-bottom: 10px;
  }
</style>
